<?php

/**
 * @author     bigface.cc
 * @date       2012-7-8 
 * @version    1.0
 */
//后台管理员模型
class adminModel extends RelationModel {

        protected $_link = array(
            'role' => array(
                'mapping_type' => BELONGS_TO,
                'class_name' => 'items_cate',
                'foreign_key' => 'role_id',
            ),
        );

        public function check_username($user_name, $id='') {
                $where = "user_name='$user_name'";
                if ($id) {
                        $where .= " AND id<>'$id'";
                }
                $id = $this->where($where)->getField('id');
                if ($id) {
                        //存在
                        return false;
                } else {
                        //不存在
                        return true;
                }
        }

}